<?php
include_once('conn.php');
include_once('settings.php');

if(!isset($_REQUEST['id']) || intval($_REQUEST['id']) < 1)
{
	header("Location:404.html");
	exit();
}
$id = $_REQUEST['id'];
//increase hits number
increase_article_hits_number($id);

$query = sprintf("SELECT * FROM `news` WHERE `id`=%d",$id);
$result=mysql_query($query);
if($result == false)
	exit(sprintf("%s%s%s",mysql_error(),__FILE__,__LINE__));
	
$info = mysql_fetch_assoc($result);

if($info == false || $info['isok'] != '1')
{
	header("Location:404.html");
	exit();
}
	
//fetch pages
$query = sprintf("SELECT `content` FROM `news2` WHERE `newsid`=%d",$info['id']);
$result=mysql_query($query);
if($result == false)
	exit(sprintf("%s%s%s",mysql_error(),__FILE__,__LINE__));
$page_list = array();
while(($row = mysql_fetch_assoc($result)))
{
	$page_list[] = $row;
}



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> [ BIOS Monthly ]  <?php echo html_safe($info['title']);?> </title>
<meta name="description" content="<?php echo utf8substr(strip_tags($info['content']),0,250);?>" />
<?php
	$meta_keywords = '';
	if(strlen($info['tagcloud']) > 0)
		$meta_keywords .= $info['tagcloud'].',';
	if(strlen($info['tagcloud1']) > 0)
		$meta_keywords .= $info['tagcloud1'].',';
	if(strlen($info['tagcloud2']) > 0)
		$meta_keywords .= $info['tagcloud3'].',';
	if(strlen($info['tagcloud3']) > 0)
		$meta_keywords .= $info['tagcloud3'].',';
	if(strlen($info['tagcloud4']) > 0)
		$meta_keywords .= $info['tagcloud4'].',';
	if(strlen($info['tagcloud5']) > 0)
		$meta_keywords .= $info['tagcloud5'].',';
	if(strlen($meta_keywords) > 0)
		$meta_keywords = substr($meta_keywords,0,-1);
?>
<meta name="KEYWORDS" CONTENT="<?php echo $meta_keywords;?>" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<script src="js/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript" src="js/image.gallery.js"></script>
<script src="js/jquery.bxSlider2.min.js" type="text/javascript"></script>
<script src="js/jquery.plugin.fullscreen.js" type="text/javascript"></script>
<script src="js/page.js" type="text/javascript"></script>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$(".hoverFeature ,.hoverColumn,.hoverNews,.hoverEvent , .hoverRss").css("opacity","0");
		$(".hoverFeature ,.hoverColumn,.hoverNews,.hoverEvent , .hoverRss").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, "fast");
		},
		function () {
			$(this).stop().animate({
				opacity: 0
			}, "fast");
		});
		});
	</script>
<body>
<div id="all"><!-- start #all //-->
<div id="main" class="clearfix"><!-- start #main //-->
<?php include_once('top-main.php');?>

<script language="javascript" src="js/rAlert.js"></script>
<script language="javascript">
function mail_to(id) {
		rAlert("mail.php?title=<?php echo urlencode(html_safe($info["title"]));?>&url=<?php echo urlencode(sprintf("contacta.php?id=%d",$_REQUEST['id']));?>" , null, "文章轉寄", 620, 380);
}
function addFacebook() {
 
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(window.location.href)+'&t='+encodeURIComponent('<?php echo html_safe($info['title']);?>'),'_blank');
}
</script>
<div id="contactd"><!-- start #contactc //-->
  <h3><?php echo html_safe($info['title']);?></h3>
  <p><?php echo stripslashes($info['content'])?></p>
  <?php if(strlen($info["images1"]) > 0):?>
	<img src="upfiles/<?php echo html_safe($info["images1"]);?>" width="890" height="492" class="contactd-img" />
	<?php endif;?>
  <div id="contactd-1">
    <ul>
      <li>Download: </li>
      <?php if(strlen($info["images2"]) > 0):?>
      <li><a href="upfiles/<?php echo html_safe($info["images2"]);?>" target="_blank">1680x1050  </a></li> 
      <?php endif;?>
       <?php if(strlen($info["images3"]) > 0):?> 
     <li> <a href="upfiles/<?php echo html_safe($info["images3"]);?>" target="_blank">1280x1024</a></li>
     <?php endif;?>
    </ul>
  </div>
  <div id="contactd-2">
    <ul>
    <li>
  <iframe src="http://www.facebook.com/plugins/like.php?app_id=217457261619168&amp;href=www.biosmonthly.com/<?php echo urlencode(sprintf("contactc.php?id=%d",$_REQUEST['id']));?>&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>
</li>
      <li><a href="#" onclick="javascript:addFacebook();return false;"><img src="images/btn-facebook2.png" width="17" height="16" /></a></li>
  <li><a href="#" onclick="javascript:mail_to(<?php printf("%d",$info["id"]);?>);return false;"><img src="images/btn-mail2.png" width="25" height="17" /></a></li>
   
    </ul>
  </div>
  
  </div><!-- end #contactc //-->

  
  <?php $extra_read_list = get_article_extra_read($info['id']);?>
	<?php include_once('block_extra_read.php');?>

</div><!-- end #main //-->
</div><!-- end #all //-->

<?php include_once('down.php');?>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22189695-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>
</html>